<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head>
	<meta http-equiv="content-type" content="text/xml; charset=utf-8" /> 
    <title>Tour Booking</title>
    <meta name="description" content=""  /> 
	<meta name="keywords" content=""  /> 
	<link rel="stylesheet" type="text/css" href="formatstyles.css"/> 
	<link rel="stylesheet" type="text/css" href="divstyles.css"/> 
    <link rel="stylesheet" type="text/css" href="style/css/jquery-ui-1.8.18.custom.css" />
	
	<!-- include CSS always before including js -->

	<!-- include jQuery library -->
	<link href="style.css" rel="stylesheet" type="text/css" media="screen" />
	<script type="text/javascript" src="js/jquery-1.7.2.js"></script>
	<script type="text/javascript" src="js/jquery.cycle.all.js"></script>
	<script type="text/javascript" src="js/scripts.js"></script>
	<script type="text/javascript" src="js/jquery-ui-1.8.18.custom.min.js"></script>
	<script type="text/javascript" src="js/login.js"></script>
	<script type="text/javascript" src="js/register.js"></script>
	<link rel="stylesheet" type="text/css" media="screen" href="style/css/demos.css"/>
	<style type="text/css" media="screen"> 
		@import "style/css/uni-form.css"; 
	</style>
	
	<!-- Demo page js -->
	<script type="text/javascript" src="js/jquery.min.js"></script>
	<script type="text/javascript" src="js/jquery.uni-form.js"></script>
	
	<!-- Star Rating widget stuff here... -->
	<script type="text/javascript" src="js/jquery.ui.stars.js"></script>
	<link rel="stylesheet" type="text/css" href="style/css/crystal-stars.css"/>
	<script type="text/javascript" src ="js/language-en.js"></script> 
	<script type="text/javascript" src ="js/nopcart.js" language="javascript"> 
	
      //============================================================== 
      //               NOP Design JavaScript Shopping Cart               
      //-------------------------------------------------------------- 
	  //       Visit NOP Design at http://www.nopdesign.com/freecart     
	  //============================================================== 
	</script> 

	<script type="text/javascript" src="js/validate.js"></script>
</head>

<body>
<div id="fade" style="display:none;"></div>
	<!-- This is the page section -->
	<div id="page_section">

		<!-- This is the banner --> 
		<div> 
 			<?php include("banner.php"); ?>
		</div> 
		<!-- This is end of the banner --> 
    
    	<div id="user-cpanel">
			<?php include("user_cpanel.php"); ?>
        </div>
        
        <div class="wan-clear"></div>
        
        <div id="user-form">
       		<?php include("user-form.php"); ?>
		</div>
        
		<div id="topnav">
           <?php include("top-nav.php"); ?>
        </div>
			
		<div id="left-top">
            <div class="title-text">Search Tour</div>
            <?php include("search-form.php"); ?>	    
		</div>
		
		<div id="right-top">
        
			<div class="title-text">Booking</div>
            
            <form name="booking" onsubmit="return validateBooking()" id="book" action="tour_booking.php" method="post"><fieldset>
            	<table>
                	<caption>Tour Information</caption>
                	<tr>
                    	<td class="label">Tour name</td>
                        <td class="tour_name">
							<?php echo $tourRecord['t_name'];
                            	  echo '<input type="hidden" name="tourID" value="'.$tourRecord['tourID'].'" />
                                  		<input type="hidden" name="tourName" value="'.$tourRecord['t_name'].'" />
                                  		<input type="hidden" name="tourPrice" value="'.$tourRecord['price'].'" />';
                            ?>
                        </td>
                    </tr>
                               
                    <tr>
                    	<td class="label">Number of visitors *</td>
                        <td>
                        	<select name="numVisitor" style="width:170px">
                            	<?php
                                	echo '<option value="0">Select</option>';
                                	for ($i=1; $i<11; $i++)
                                    {
                                     	echo '<option value="'.$i.'">'.$i.'</option>';   
                                    }
                                ?>
                        	</select>
                        </td>
                    </tr>
                    
                    <tr>
                    	<td class="label">Transportation *</td>
                        <td>
							<select name="transportID" style="width:170px">
                                <?php
									echo '<option value="0">Select</option>';
									while ($record = mysql_fetch_array($transportResult))
                                    {
                                        echo '<option value="'.$record['transportID'].'">'.$record['name'].'</option>';
                                    }                
                                ?>
							</select>
                        </td>
                    </tr>
                    
					<tr>
                    	<td class="label">Date *</td>
						<?php 
                            echo '<td><input id="booking'.$tourID.'" name="date" style="width:165px"/></td>';
                                        
                            $data_arrs = array();
                            $arrs = array('1'=>'Monday','2'=>'Tuesday','3'=>'Wednesday','4'=>'Thursday','5'=>'Friday','6'=>'Saturnday','0'=>'Sunday');
                                    
                            while ($record_occurance = mysql_fetch_array($occurance_result)) {
                            	array_push($data_arrs,$record_occurance['dayName']);
                            }
							
                            $stringDay ="";
							foreach ($arrs as $key => $value) {
								if (!in_array($value,$data_arrs)) {
									$stringDay .= "day != '$key' && ";
								}
							}

							if (strlen($stringDay)>0) {
								echo '<script type="text/javascript">$(function(){
								var now = new Date();
								$( "#booking'.$tourID.'" ).datepicker({
									dateFormat:"dd-mm-yy",
									minDate: now,
									
									beforeShowDay: function(date) {
										var day = date.getDay();
										return [('.substr($stringDay,0,strlen($stringDay)-4).')];
									}
								});
							});
							</script>';	
							} else {
								echo '<script type="text/javascript">$(function(){
								var now = new Date();
								$( "#booking'.$tourID.'" ).datepicker({
									dateFormat:"dd-mm-yy",
									minDate: now,
								});
							});
							</script>';
}
							
						?>
                    </tr>
                </table>
                <div class="note">(*) These fields are required</div>
                <center><input type="submit" value="Submit" /></center>
            </fieldset></form>
		</div>

		<div class="wan-clear"></div>
		
<!-- This is end of the content -->
	</div> 
<!-- This is end of the page section -->
<br />
<!-- This is the footer -->
		<div id="footer"> 
			<p class="footer">This website is a student project that is intended to be used only for academic purposes. This page was created by Dat, Duong Xuong</p>
		</div> 
<!-- This is end of the footer -->
</body>

</html>